home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / distutils / extension.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  4KB  |  145 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. __revision__ = '$Id: extension.py 37623 2004-10-14 10:02:08Z anthonybaxter $'
  5. import os
  6. import string
  7. import sys
  8. from types import *
  9.  
  10. try:
  11.     import warnings
  12. except ImportError:
  13.     warnings = None
  14.  
  15.  
  16. class Extension:
  17.     
  18.     def __init__(self, name, sources, include_dirs = None, define_macros = None, undef_macros = None, library_dirs = None, libraries = None, runtime_library_dirs = None, extra_objects = None, extra_compile_args = None, extra_link_args = None, export_symbols = None, swig_opts = None, depends = None, language = None, **kw):
  19.         self.name = name
  20.         self.sources = sources
  21.         if not include_dirs:
  22.             pass
  23.         self.include_dirs = []
  24.         if not define_macros:
  25.             pass
  26.         self.define_macros = []
  27.         if not undef_macros:
  28.             pass
  29.         self.undef_macros = []
  30.         if not library_dirs:
  31.             pass
  32.         self.library_dirs = []
  33.         if not libraries:
  34.             pass
  35.         self.libraries = []
  36.         if not runtime_library_dirs:
  37.             pass
  38.         self.runtime_library_dirs = []
  39.         if not extra_objects:
  40.             pass
  41.         self.extra_objects = []
  42.         if not extra_compile_args:
  43.             pass
  44.         self.extra_compile_args = []
  45.         if not extra_link_args:
  46.             pass
  47.         self.extra_link_args = []
  48.         if not export_symbols:
  49.             pass
  50.         self.export_symbols = []
  51.         if not swig_opts:
  52.             pass
  53.         self.swig_opts = []
  54.         if not depends:
  55.             pass
  56.         self.depends = []
  57.         self.language = language
  58.         if len(kw):
  59.             L = kw.keys()
  60.             L.sort()
  61.             L = map(repr, L)
  62.             msg = 'Unknown Extension options: ' + string.join(L, ', ')
  63.             if warnings is not None:
  64.                 warnings.warn(msg)
  65.             else:
  66.                 sys.stderr.write(msg + '\n')
  67.         
  68.  
  69.  
  70.  
  71. def read_setup_file(filename):
  72.     parse_makefile = parse_makefile
  73.     expand_makefile_vars = expand_makefile_vars
  74.     _variable_rx = _variable_rx
  75.     import distutils.sysconfig
  76.     TextFile = TextFile
  77.     import distutils.text_file
  78.     split_quoted = split_quoted
  79.     import distutils.util
  80.     vars = parse_makefile(filename)
  81.     file = TextFile(filename, strip_comments = 1, skip_blanks = 1, join_lines = 1, lstrip_ws = 1, rstrip_ws = 1)
  82.     extensions = []
  83.     while None:
  84.         line = file.readline()
  85.         if line is None:
  86.             break
  87.         
  88.         if _variable_rx.match(line):
  89.             continue
  90.         
  91.         if line[-1] == line[-1]:
  92.             pass
  93.         elif line[-1] == '*':
  94.             file.warn("'%s' lines not handled yet" % line)
  95.             continue
  96.         
  97.         line = expand_makefile_vars(line, vars)
  98.         words = split_quoted(line)
  99.         module = words[0]
  100.         ext = Extension(module, [])
  101.         append_next_word = None
  102.         for word in words[1:]:
  103.             if append_next_word is not None:
  104.                 append_next_word.append(word)
  105.                 append_next_word = None
  106.                 continue
  107.             
  108.             suffix = os.path.splitext(word)[1]
  109.             switch = word[0:2]
  110.             value = word[2:]
  111.             if suffix in ('.c', '.cc', '.cpp', '.cxx', '.c++', '.m', '.mm'):
  112.                 ext.sources.append(word)
  113.                 continue
  114.             None if switch == '-I' else equals == -1
  115.             if switch == '-U':
  116.                 ext.undef_macros.append(value)
  117.                 continue
  118.             if switch == '-C':
  119.                 ext.extra_compile_args.append(word)
  120.                 continue
  121.             if switch == '-l':
  122.                 ext.libraries.append(value)
  123.                 continue
  124.             if switch == '-L':
  125.                 ext.library_dirs.append(value)
  126.                 continue
  127.             if switch == '-R':
  128.                 ext.runtime_library_dirs.append(value)
  129.                 continue
  130.             if word == '-rpath':
  131.                 append_next_word = ext.runtime_library_dirs
  132.                 continue
  133.             if word == '-Xlinker':
  134.                 append_next_word = ext.extra_link_args
  135.                 continue
  136.             None if word == '-Xcompiler' else value
  137.             if suffix in ('.a', '.so', '.sl', '.o', '.dylib'):
  138.                 ext.extra_objects.append(word)
  139.                 continue
  140.             file.warn("unrecognized argument '%s'" % word)
  141.         
  142.         continue
  143.         return extensions
  144.  
  145.